package org.mall.common.util.jsonschema;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import org.mall.common.util.ServiceExceptionUtil;

import java.io.IOException;

/***
 *@author yinxucun
 *@date 2019-12-01 16:25 
 */
public class String2LongDeserialize extends JsonDeserializer<Long> {
    @Override
    public Long deserialize(JsonParser p, DeserializationContext ctxt)  {
        try {
            return Long.parseLong(p.getText());
        } catch (IOException e) {
            throw  ServiceExceptionUtil.exception(11111,"解析Long类型参数错误");
        }
    }
}
